import os

# 定义新的目录结构
structure = {
    "my_query_project_new": {
        "requirements.txt": "",
        "main.py": "",
        "README.md": "",
        "config": {
            "__init__.py": "",
            "config.py": "",
        },
        "core": {
            "__init__.py": "",
            "query": {
                "__init__.py": "",
                "query_processor.py": "",
                "query_executor.py": "",
                "prompt": {
                    "__init__.py": "",
                    "prompt_builder.py": "",
                },
            },
            "data": {
                "__init__.py": "",
                "data_handler.py": "",
                "markdown_converter.py": "",
            },
            "memory": {
                "__init__.py": "",
                "session_manager.py": "",
                "memory_handler.py": "",
            },
        },
        "api": {
            "__init__.py": "",
            "user_input_handler.py": "",
        },
        "presentation": {
            "__init__.py": "",
            "result_presenter.py": "",
        },
        "tests": {
            "__init__.py": "",
            "test_user_input_handler.py": "",
            "test_data_handler.py": "",
            "test_query_executor.py": "",
            "test_result_presenter.py": "",
            "test_query_processor.py": "",
            "test_session_manager.py": "",
        },
        "data": {},  # data 文件夹存在，但不创建文件
    },
}

def create_structure(base_path, structure):
    for name, content in structure.items():
        path = os.path.join(base_path, name)
        if isinstance(content, dict):
            os.makedirs(path, exist_ok=True)
            create_structure(path, content)
        else:
            with open(path, 'w', encoding='utf-8') as f:
                f.write(content)

# 创建目录结构
base_path = os.getcwd()  # 选择合适的路径
create_structure(base_path, structure)

